package com.glsc.ngateway.common.api.ldap.feign;

/*
import com.glsc.glam.conf.FeignConfiguration;
*/

import com.glsc.ngateway.common.api.common.config.FeignMultipartSupportConfig;
import com.glsc.ngateway.common.api.ldap.dto.*;
import com.glsc.ngateway.common.api.ldap.resp.AppEhrResponse;
import com.glsc.ngateway.common.api.ldap.resp.InterfaceReponse;
import com.glsc.ngateway.common.api.ldap.resp.LdapResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xuchang
 * @Descirpion Feign 接口调用
 */
@FeignClient(value = "eureka-client-ldap", configuration = FeignMultipartSupportConfig.class)  // 调用的服务的名称
public interface IFeignLdapService {
    @PostMapping(value = "/ldapUser/loginWithoutCode", produces = {"application/json"})
    InterfaceReponse<TokenMapDto> loginWithoutCode(@RequestBody LdapUserDto ldapUserDto);

    @RequestMapping(method = RequestMethod.POST, value = "/ehr/queryEhr")
    LdapResponse<List<LdapEhrEmpDto>> getUserList(@RequestBody LdapEhrEmpSearchDto param);

    @RequestMapping(method = RequestMethod.POST, value = "/ehr/save")
    LdapResponse<Void> save(@RequestBody List<LdapEhrEmpDto> data);


    @RequestMapping(method = RequestMethod.POST, value = "/ehr/queryDept")
    LdapResponse<List<LdapEhrDeptDto>> getDepartmentList(@RequestBody LdapEhrDeptSearchDto param);

    /**
     * simple条件查询部门信息,只简单的根据domain中的值进行查找，不包含任何关联业务逻辑
     *
     * @param param
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/ehr/findDeptByCondition")
    LdapResponse<List<LdapEhrDeptDto>> findDeptByCondition(@RequestBody LdapEhrDeptDto param);

    @RequestMapping(method = RequestMethod.POST, value = "/ehr/queryComp")
    LdapResponse<List<LdapEhrCompDto>> getCompanyList(@RequestBody LdapEhrCompSearchDto param);

    @RequestMapping(method = RequestMethod.POST, value = "/ldapUser/login")
    String login(@RequestBody LdapUserDto ldapUserDto) throws Exception;


    @RequestMapping(method = RequestMethod.POST, value = "/ldapUser/checkToken")
    String checkToken(@RequestBody LdapUserDto ldapUserDto) throws Exception;

    @RequestMapping(method = RequestMethod.POST, value = "/ldapUser/getOaUserToken")
    String getOaUserToken(@RequestBody LdapUserDto ldapUserDto);

    @RequestMapping(method = RequestMethod.GET, value = "/ehr/getUserList")
    LdapResponse<List<LdapEhrEmpDto>> getUserList(@RequestParam(value = "department", required = false) String department,
                                                  @RequestParam(value = "filteAlive", required = false) boolean filteAlive);

    @RequestMapping(value = "/ehr/getemp", method = RequestMethod.GET)
    AppEhrResponse<LdapEhrEmpDto> getLdapEhrEmp(@RequestParam(value = "account", required = false) String account,
                                                @RequestParam(value = "userId", required = false) String userId,
                                                @RequestParam(value = "filteAlive", required = false) boolean filteAlive);

    @RequestMapping(value = "/ehr/findUserListByUserLeaderAccount", method = RequestMethod.GET)
    AppEhrResponse<List<LdapEhrEmpDto>> findUserListByUserLeaderAccount(@RequestParam("userAccount") String userAccount);

    @RequestMapping(value = "/ehr/findUserListByUserLeaderAccountList", method = RequestMethod.POST)
    AppEhrResponse<List<LdapEhrEmpDto>> findUserListByUserLeaderAccountList(@RequestBody List<String> userAccountList);

    @RequestMapping(value = "/ehr/getEmpsByAccounts", method = RequestMethod.POST)
    AppEhrResponse<List<LdapEhrEmpDto>> getEmpsByAccounts(@RequestBody List<String> userAccounts);

    @RequestMapping(value = "/ehr/getAllDept", method = RequestMethod.GET)
    AppEhrResponse<List<LdapEhrDeptDto>> getAllDept();

    @RequestMapping(value = "/ehr/getEmpsByDepts", method = RequestMethod.POST)
    AppEhrResponse<List<LdapEhrEmpDto>> getEmpsByDepts(@RequestBody List<String> depts);

    @RequestMapping(value = "/ehr/getAllEmps", method = RequestMethod.GET)
    AppEhrResponse<List<LdapEhrEmpDto>> getAllEmps();

    @RequestMapping(value = "/ehr/getempdept", method = RequestMethod.GET)
    AppEhrResponse<LdapEhrEmpDto> gettAmEhrEmpDept(@RequestParam("userId") String userId);

    @RequestMapping(value = "/ehr/getDepByAccount", method = RequestMethod.GET)
    AppEhrResponse<LdapEhrDeptDto> getDepByAccount(@RequestParam("account") String account);

    @RequestMapping(value = "/ldapUser/checkTokenAndReturnOaToken", method = RequestMethod.POST)
    LdapResponse<String> checkTokenAndReturnOaToken(@RequestBody LdapUserDto ldapUserDto) throws Exception;

    @RequestMapping(method = RequestMethod.POST, value = "/ldapUser/checkWorkWechatToken")
    LdapResponse<LdapWorkWechatTokenCheckResultDto> checkWorkWechatToken(@RequestBody LdapWorkWechatTokenCheckParamDto token);


    @RequestMapping(value = "/ehr/getByOaUserIdList", method = RequestMethod.POST)
    LdapResponse<List<LdapEhrEmpDto>> getByOaUserIdList(@RequestBody List<Integer> oaUserIdList);
}
